package model;

import java.sql.ResultSet;

public class TUser {
    private String userid;
    private String username;
    private String pwd;
    private int utid;
    private String phone;

    public TUser() {
    }

    public TUser(String userid, String username, String pwd, int utid, String phone) {
        this.userid = userid;
        this.username = username;
        this.pwd = pwd;
        this.utid = utid;
        this.phone = phone;
    }

    @Override
    public String toString() {
        return "TUser{" +
                "userid='" + userid + '\'' +
                ", username='" + username + '\'' +
                ", pwd='" + pwd + '\'' +
                ", utid=" + utid +
                ", phone='" + phone + '\'' +
                '}';
    }

    public TUser(ResultSet rs){
        try{
            if(rs!=null && rs.next()){
                this.setUserid(rs.getString("userid"));
                this.setUsername(rs.getString("username"));
                this.setPwd(rs.getString("pwd"));
                this.setUtid(rs.getInt("utid"));
                this.setPhone(rs.getString("phone"));
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public int getUtid() {
        return utid;
    }

    public void setUtid(int utid) {
        this.utid = utid;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}
